package com.zhongli.devplatform.security.weixin;

import com.zhongli.devplatform.bean.SecurityUser;
import org.springframework.security.authentication.AbstractAuthenticationToken;


public class WeixinAuthenticationToken extends AbstractAuthenticationToken {


    private String weixinId;
    private SecurityUser securityUser;


    public WeixinAuthenticationToken(String weixinId) {

        super(null);
        super.setAuthenticated(false);// 注意这个构造方法是认证时使用的
        this.weixinId = weixinId;
    }

    public WeixinAuthenticationToken(String weixinId, SecurityUser user) {
        super(user.getAuthorities());
        this.weixinId = weixinId;
        this.securityUser = user;
    }

    public String getWeixinId() {
        return weixinId;
    }

    @Override
    public Object getCredentials() {
        return weixinId;
    }

    @Override
    public Object getPrincipal() {

        return securityUser;
    }
}
